<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>捡漏订单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
</head>
<body>

<style>
    .layui-table-cell{  /*最后的pic为字段的field*/
        height: 100%;
        max-width: 100%;
    }
</style>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">捡漏订单列表</div>
                <div class="layui-card-body">


                    <div class="layui-form-item layui-form">

                        {if !empty($res)}
                        <div class="layui-inline">
                            <label class="layui-form-label">订单编号</label>
                            <div class="layui-input-block">
                                <select name="order_sn" lay-verify="" lay-search id="order_sn">
                                    <option value="">请选择</option>
                                    {foreach $res as $k=>$v}
                                    <option value="{$v['order_sn']}">{$v['order_sn']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        {/if}


                        <div class="layui-inline">
                            <div class="layui-btn-group test-table-operate-btn">
                                <button class="layui-btn" data-type="searchUserButton">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate" lay-size="lg">

                        <script type="text/html" id="is_use_switch">
                            <input type="checkbox" name="is_display" lay-skin="switch" lay-text="上架|下架" lay-filter="is_use_switch" value="{{ d.is_display }}" data-json="{{ encodeURIComponent(JSON.stringify(d)) }}" {{ d.is_display == 1 ? 'checked' : '' }}>
                        </script>

                    </table>

                    <script type="text/html" id="test-table-operate-barDemo">


                    </script>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form;

        table.render({
            elem: '#test-table-operate'
            ,url: "{:url('Jlou/refund')}"
            ,height: 'full-155'
            ,cols: [[
                {field:'id',width:80,align:"center",  title: '订单ID'}
                ,{field:'refund_sn',align:"center",title: '退款单号'}
                ,{field:'refund_money',align:"center",title: '退款金额'}
                ,{field:'refund_time',align:"center",title: '退款时间'}
                ,{field:'order_sn',align:"center",title: '订单编号'}
                ,{field:'pay_type',align:"center",title: '退回位置',templet:function(d){
                        if (d.pay_type == 1){
                            return "支付宝";
                        }else if(d.pay_type == 2){
                            return "微信";
                        }
                    }}
            ]]
            ,page: true
            ,limit: 20
        });

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });


        var $ = layui.$, active = {
            searchUserButton:function(){
                var order_sn  = $('#order_sn').val();
                var date  = $('#date').val();
                var is_kaijiang = $("#is_kaijiang").val();
                table.reload('test-table-operate', {
                    where: {
                        order_sn: order_sn,
                        date:date,
                        is_kaijiang:is_kaijiang
                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                //return false;
            },

        };
        //绑定点击事件
        $('.test-table-operate-btn .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });


    });



</script>


</body>
</html>